//
//  LongHelper.h
//  CoachsBook
//
//  Created by huiyong li on 2022/8/18.
//

#import <Foundation/Foundation.h>
#import <sys/utsname.h>

typedef void(^CustomHandler)(UIAlertAction * action);
NS_ASSUME_NONNULL_BEGIN

@interface LongHelper : NSObject
//快速创建alertController对象
+ (UIAlertController *)alertWithTitle:(NSString *)title messgage:(NSString *)message okTitle:(NSString *)okTitle;

+ (void)poppingAlertWithReminderTitle:(NSString *)reminderStr message:(NSString *)str AndActionTitle:(NSString *)yesStr ActionHandler:(CustomHandler)customHandler ViewController:(UIViewController *)selfVC;

+ (void)poppingAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndYesActionTitle:(NSString *)yesStr YesActionHandler:(CustomHandler)yesHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;


+ (void)poppingAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;

//修改第二个登录的字体颜色
+ (void)KPCXWAnotherpoppingAlertWithReminderTitle:(NSString *)reminderStr message:(NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;



//快速创建测试alertController对象
+ (void)alertWithtTestViewController:(UIViewController *)selfVC;

+(void)poppingBottomAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndThreeActionTitle:(NSString *)threeStr ThreeActionHandler:(CustomHandler)threeHandler AndFourActionTitle:(NSString *)fourStr FourActionHandler:(CustomHandler)fourHandler AndFiveActionTitle:(NSString *)fiveStr FiveActionHandler:(CustomHandler)fiveHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;

+(void)poppingBottomAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndThreeActionTitle:(NSString *)threeStr ThreeActionHandler:(CustomHandler)threeHandler AndFourActionTitle:(NSString *)fourStr FourActionHandler:(CustomHandler)fourHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;

//底部弹框
+(void)poppingBottomAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;
+(void)poppingBottomAlertWithReminderTitle:(nullable NSString *)reminderStr message:(nullable NSString *)str AndOneActionTitle:(NSString *)oneStr OneActionHandler:(CustomHandler)oneHandler AndTwoActionTitle:(NSString *)twoStr TwoActionHandler:(CustomHandler)twoHandler AndThreeActionTitle:(NSString *)threeStr ThreeActionHandler:(CustomHandler)threeHandler AndCancelActionTitle:(NSString *)cancelStr NoActionHandler:(CustomHandler)noHandler ViewController:(UIViewController *)selfVC;


+(CGFloat)textHeight:(NSString *)str WithUIFont:(UIFont *)font AndWidth:(CGFloat)width;
+(CGFloat)textWidth:(NSString *)str WithUIFont:(UIFont *)font AndHeight:(CGFloat)height;



/** 给控件添加部分圆角
  * @param rect 控件的rect
  * @param corners 需要设置为圆角的角 UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight | UIRectCornerAllCorners
  * @param cornerRadii 需要设置的圆角大小 CGSize
  * @param roundView 需要设置圆角的控件
**/
+ (void)addCornerWithRoundedRect:(CGRect)rect RoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii roundView:(UIView *)roundView;



//获取缓存大小
+ (NSString *)getCacheSize;

//清理缓存
+ (void)cleanCacheWithSuccess:(void (^)(BOOL success))successBlock;


#pragma mark 计算日期1与日期2的时差
+ (NSInteger)timeWithYearMonthDayCountDown:(NSString *)timestamp1 AndTiem:(NSString *)timestamp2;


#pragma mark 计算tagviewCell高度
+ (CGFloat )createTagButtonToArr:(NSArray *)arr WithViewWidth:(CGFloat)Viewwidth WithwidthNumber:(NSInteger)widthNumber;


//判断app是否第一次启动或者更新后第一次启动
+ (BOOL) isFirstLoad ;
//判断是不是刘海屏
+ (BOOL)isNotchScreen;

+ (NSString *)JSONEncode:(id)dic;

+ (id)JSONDecode:(NSString *)json;

+ (NSInteger)timestamp;
+ (NSDate *)timeStringToDate:(NSString *)dateString;
+ (NSDictionary *)parseJSONStringToNSDictionary:(NSString *)JSONString;
+ (long long)fileSizeAtPath:(NSString*)filePath;
+ (NSString*)MD5ofData:(NSData *)fileData;
+ (NSString*)getMD5String:(NSString *)str;

//小写
+ (NSString*)md532BitLowerWith:(NSString *)str;
//大写
+ (NSString*)md532BitUpperWith:(NSString *)str;


+ (BOOL)isExistFile:(NSString *)fileName;
//+ (NSString *)storeArticleFile:(NSString *)content;
//+ (NSString*)STT:(NSString *)string;
+ (NSString *)getWeekDayFordate:(NSDate*)date;
+ (NSString *)nameOfWebCode:(NSInteger)code;
+ (NSInteger)calcDaysFromBegin:(NSDate *)beginDate end:(NSDate *)endDate;
+ (NSString *)formatDateFromTimestamp:(NSInteger)unixtime;

+ (NSString *)formatDateFromTimestampOfBookMark:(NSInteger)time;

+ (NSString *)getTimeStringforDate:(NSDate *)date;

//将时间格式转成YYYY-MM-DD输出
+ (NSString *)getTimeStringYMDforDateString:(NSString *)dateString;
//将时间YYYY-MM-DD格式转成YYYY.MM.DD输出
+ (NSString *)getTimeStringforDateString:(NSString *)dateString;
//将时间格式转成MM/DD输出
+ (NSString *)getTimeStringMDforDateString:(NSString *)dateString;
//将时间YYYY-MM-DD格式转成周几输出
+ (NSString *)getTimeStringforWeekString:(NSString *)dateString;
+ (NSString *)getTimeStringforYMDHMSString:(NSString *)dateString;

+ (NSMutableArray*)arrayOfString:(NSString*)string;

+ (UIImage *)imageWithView:(UIView *)view;

+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize;

+ (NSString *)orderDateString:(NSDate*)date;

+ (NSInteger)calDuringTime:(NSDate *)startDate end:(NSDate *)endDate;

+ (NSString *)weekdayText:(NSInteger)week;

+ (void)originImage:(UIImage *)image scaleToSize:(CGSize)size returnImage:(void (^)(UIImage *image))complete;

+ (NSString *)showDistance:(NSInteger)meter;

+ (NSArray *)getDatesSinceCurence:(NSInteger)weeks;

+ (NSString *)thumbnailURL:(NSString *)url;

+ (BOOL)checkStringIsLegal:(NSString *)str;
+ (BOOL)checkDictionaryIsLegal:(NSDictionary *)dic allowEmpty:(BOOL)allow;
+ (NSDictionary *)filterDicForKeys:(NSArray *)keys dic:(NSDictionary *)dic;
+ (UIImage *)coreBlurImage:(UIImage *)image withBlurNumber:(CGFloat)blur;
+ (NSString *)getNowTimeTimestamp;

+ (NSString *)toJSONData:(id)theData;
+ (void)shadowAndCircular:(id)view;
+ (NSString *)base64EncodeString:(NSString *)string;
+ (NSString *)base64EncodeImage:(UIImage *)image;
+ (NSString *)sha1:(NSString *)string;

#pragma mark  验证输入是否为数字
+ (BOOL)validateNumber:(NSString*)number;
#pragma mark - 判断文件是否存在
+ (BOOL)isFileExist:(NSString *)fileName;
#pragma mark - 获取沙盒目录
+ (NSURL *)applicationDocumentsDirectory;
#pragma mark - 根据日期计算出 （年）岁 月
+ (NSString *)changeAge:(NSString *)dateString;
+ (NSString *)lastTimeOfComment:(NSDate *)date;
#pragma mark 判断是否WiFi环境
+ (BOOL)isWiFiEnabled;
#pragma mark 解决丢精度的问题
+ (NSString *)reviseString:(NSString *)str;
#pragma mark 根据高度度求宽度  text 计算的内容  Height 计算的高度 font字体大小
+ (CGFloat)getWidthWithText:(NSString *)text height:(CGFloat)height font:(UIFont*)font;
+ (NSInteger)timeSwitchTimestamp:(NSString *)formatTime andFormatter:(NSString *)format;
+ (NSString *)changeFloatWithFloat:(NSString*)floatString;
#pragma mark 验证手机号码，中间用****代替
+ (NSString *)numberSuitScanf:(NSString*)number;
#pragma mark 验证字符串是否为空
+ (BOOL)isBlankString:(NSString *)aStr;
#pragma mark UIColor 转UIImage
+ (UIImage*) createImageWithColor: (UIColor*)color;
#pragma mark  获取暂停的时间
+ (NSInteger)getSuspendTime:(NSInteger)ids;
#pragma mark  获取iPhone型号
+ (NSString *)iphoneType;
#pragma mark 校验手机号码格式
+ (BOOL)checkPhoneNumber:(NSString *)phoneNumber;

+ (BOOL)theStringIsAllNumbers:(NSString*)str;
+ (BOOL)isNum:(NSString *)checkedNumString;


#pragma mark 获取第day N天后的date
+ (NSDate *)getTimeAfterNowDate:(NSDate*)nowDate WithDay:(NSInteger)day;

#pragma mark 获取第nowDate在当天的分钟数
+ (NSInteger)getHoursTimeAfterNowDate:(NSDate*)nowDate;

#pragma mark 获取当前网络时间
+ (NSString *)getInternetDate;

#pragma mark 获取当前网络时间是几点
+ (NSString *)getInternetHoursDate;

#pragma mark 计算日期与当前时间的时差
+ (NSInteger)timeWithYearMonthDayCountDown:(NSString *)timestamp;

/**
 * 验证身份证号码是否正确的方法
 *
 * @param IDNumber 传进身份证号码字符串
 *
 * @return 返回YES或NO表示该身份证号码是否符合国家标准
 */
+(BOOL)isCorrect:(NSString *)IDNumber;


//获取当前时间加秒数后转时间字符串
+ (NSString *)formatDateFromTimestampAddSeconds:(NSInteger)time;

#pragma mark 验证字符串是否包含敏感词汇
+ (BOOL)isViolationsString:(NSString *)aStr;

@end

NS_ASSUME_NONNULL_END
